const put = (key, value) => {
  wx.setStorage({
    key: key,
    data: value
  })
}

const get = (key) => {
  return new Promise((resolve, reject) => {
    wx.getStorage({
      key: key,
      success(res) {
        resolve(res)
      },
      fail(err) {
        resolve(err)
      }
    })
  })

}

const remove = (key) => {
  wx.removeStorage({
    key: key
  })

}

const clear = () => {
  wx.clearStorage();
}

module.exports = {
  put,
  get,
  remove,
  clear,
}